# coding: utf-8

import os
import jieba
import config.setting as setting
from importlib import reload
import shutil
from utils import my_utils
import logging

global has_load
has_load = False


def load():
    global has_load
    if has_load is True:
        return
    has_load = True
    # 设置词典
    for file_name in setting.FILE_USER_DIC:
        if setting.profile == 'prod':
            if os.path.exists(file_name):
                jieba.load_userdict(file_name)
    # 设置关键词
    # with open(default_params.file_name_important_words) as f:
    #     lines = f.readlines()
    #     for line in lines:
    #         line = line.strip()
    #         jieba.suggest_freq(line, True)


def un_load():
    reload(jieba)
    has_load = False


def load_stop_words():
    pass
